package k1_exercise;

import java.util.Arrays;

public class Array_diffLengthTwoArraySwap {

    /**
     * 两个长度不等的数组交换 {1,2,3,4},{5,6,7,8,9,10}
     */
    public static void main(String[] args) {

        int[] nums_a = {1,2,3,4};
        int[] nums_b = {5,6,7,8,9,10};

        int[] nums_tmp;

        //因为数组是引用数据类型，所以可以交换变量所对应的堆空间中的地址
        nums_tmp = nums_a;
        nums_a = nums_b;
        nums_b = nums_tmp;

        System.out.println(Arrays.toString(nums_a));
        System.out.println(Arrays.toString(nums_b));

    }

}
